<template>
  <download-excel
    :data="data"
    :fields="titles"
    worksheet="My Worksheet"
    type="xlsx"
    :name="name"
    class="inline-b"
  >
    <c-button type="link">下载模板</c-button>
  </download-excel>
</template>

<script>
import JsonExcel from "vue-json-excel";

export default {
  components: {
    downloadExcel: JsonExcel
  },
  props: {
    // 表头
    titles: {
      type: Object
    },
    // 数据
    data: {
      type: Array
    },
    // 文件名
    name: {
      type: String
    }
  }
};
</script>
